﻿/*
 * Erstellt mit SharpDevelop.
 * Benutzer: Christian
 * Datum: 19.06.2010
 * Zeit: 10:00
 * 
 * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
 */
using System;
using System.Drawing;
using System.Windows.Forms;

namespace MovieExplorer
{
   /// <summary>
   /// Description of SettingsForm.
   /// </summary>
   public partial class SettingsForm : Form
   {
      private Settings _Settings = null;
      
      public SettingsForm(Settings settings)
      {
         //
         // The InitializeComponent() call is required for Windows Forms designer support.
         //
         InitializeComponent();
         
         //
         // TODO: Add constructor code after the InitializeComponent() call.
         //
         _Settings = settings;
         
         if(_Settings != null)
         {
            tbConfigDir.Text = _Settings.ConfigDirectory;
            tbMovies.Text = _Settings.MyMoviesDirectory;
            tbBackdropCnt.Text = _Settings.BackdropImageCount.ToString();
            cbDBUsed.Checked = _Settings.DBUsed;
            cbSQLiteV3Movies.Checked = _Settings.SQLiteV3MyMovies;
            cbSQLiteV3Recordings.Checked = _Settings.SQLiteV3Recordings;
            cbUTF8.Checked = _Settings.UTF8;
            cbRecordingService.Checked = _Settings.RecordingServiceUsed;
         }
      }
      
      public Settings Settings
      {
         get { return _Settings; }
      }
      
      void Button2Click(object sender, EventArgs e)
      {
         if(_Settings != null)
         {
            _Settings.ConfigDirectory = tbConfigDir.Text;
            _Settings.MyMoviesDirectory = tbMovies.Text;
            _Settings.BackdropImageCount = int.Parse(tbBackdropCnt.Text);
            _Settings.DBUsed = cbDBUsed.Checked;
            _Settings.SQLiteV3MyMovies = cbSQLiteV3Movies.Checked;
            _Settings.SQLiteV3Recordings = cbSQLiteV3Recordings.Checked;
            _Settings.UTF8 = cbUTF8.Checked;
            _Settings.RecordingServiceUsed = cbRecordingService.Checked;
         }
      }
   }
}
